package com.ybwh.datasource.refreshable.core;


/**
 * <p>
 * 资源持有者
 * </p>
 *
 * @author fanbeibei
 * @version V1.0
 * @since 2019/4/14 19:40
 */
public class ResourceHolder<T> {
    private volatile T resource;

    public void set(T dataSource) {
        this.resource = dataSource;
    }

    public T get() {
        if (null == resource) {
            throw new IllegalStateException("ResourceHolder is empty!!");
        }
        return resource;
    }
}
